#ifndef _H_C_POLLER_H_
#define _H_C_POLLER_H_

#include "CCoroutine.h"

namespace TB
{
	class CPoller
	{
		NON_COPYABLE(CPoller)
		NON_MOVEABLE(CPoller)
	public:
		CPoller();
		inline void Post(const std::function<void()>& rcbFunction) { m_poCoroutine->Post(rcbFunction); }
		inline void SetUserData(const std::weak_ptr<ICoroutineUserData>& poUserData) { m_poCoroutine->SetUserData(poUserData); }
		inline std::weak_ptr<ICoroutineUserData>& GetUserData() { return m_poCoroutine->GetUserData(); }
		inline const std::weak_ptr<ICoroutineUserData>& GetUserData() const { return m_poCoroutine->GetUserData(); }
		UINT64 GetID() const;

	public:
		UINT32 Poll();
	private:
		std::shared_ptr<CCoroutine> m_poCoroutine;
	};
}

#endif
